import request from '@/common/utils/request'
import {
	serv
} from '@/common/utils/config'
import indexConvert from './indexConvert'
//首页公告
export function getNoticeList(data) {
	return request(serv.sysrest + `/api/article/rollingList`, {
		method: `get`,
		data: data
	})
}
//首页轮播图
export function getCarouselList(data) {
	return request(serv.portalent + `/api/portalEnt/getCycleimgsList`, {
		method: `get`,
		data: data
	})
}
// 首页热销品目
export function getQueryHotGoods(data) {
	return request(serv.portalent + `/api/shopingMall/queryHotGoods`, {
		method: `post`,
		data: data
	})
}

//首页热门品类
export function getHotCatalogs() {
	return request(serv.sysrest + '/api/hotCatalog/hotCatalogs',{
		method: 'get'
	})
}


// 分类商品列表
export function getClassGoodLists(data) {
	return new Promise((resolve, reject) => {
		request(`/order-service/api/goods/queryGoodsListWithStandardByCatalog`, {
			method: `post`,
			data: data
		}).then(res => {
			resolve(res.data);
		})
	})
}

// 首页楼层信息
export function getFloorInfo(data) {
	return request(serv.portalent + '/api/shopingMall/queryFloorInfo', {
		method: 'get',
		data: data
	})
}

// 首页楼层信息
export function getFloorInfoWithGoods(data) {
	return request(serv.portalent + '/api/shopingMall/getFloorInfo', {
		method: 'get',
		data: data
	})
}

// 首页楼层商品信息
export function getFloorGoods(data) {
	return request(serv.portalent + '/api/shopingMall/queryFloorGoods', {
		method: 'post',
		data: data
	})
}

// 首页楼层商品信息
export function getFloorGoodsForNew(data) {
	return request(serv.portalent + '/api/shopingMall/getFloorGoods', {
		method: 'post',
		data: data
	})
}

//获取自定义热销商品
export function queryDefinedHotGood(data) {
	return request(serv.portalent + '/api/shopingMall/queryDefinedHotGoods', {
		method: 'get',
		data: data
	})
}

// 福利活动
export function getWelfareInfo(data) {
	return request(serv.welfare + '/api/activity/showOnlineInfo', {
		method: 'get',
		data: data
	})
}

// 积分查询
export function getIntegral(data) {
	return request(serv.welfare + '/api/integralUser/sumUserIntegral', {
		method: 'get',
		data: data
	})
}

// 获得待办事项数
export function getWaitCount(data){
	// return request(serv.workitemrest+`/api/workApply/getUndoByPageNum`,{
	return request(serv.workitemrest+`/api/workApply/getUndoNum`,{
		method:'GET',
		data: data
	})
}

// 获得待办事项数
export function countUndoWork(){
	return request(serv.workitemrest+`/api/workApply/countUndoWork`,{
		method:'POST',
		data: {bizType: ['order', 'integral']}
	})
}
// 获得购物车数
export function countCart(){
	return request(serv.order+`/api/cart/count_cart_items`,{
		method:'GET'
	})
}

// token获取用户信息
export function getUserInfoByToken(data){
	return request(serv.sysrest +`/api/wxmp/getUserInfoByToken`,{
		method:'POST',
		data: data
	})
}

// 开屏广告
export function queryAdversting(data) {
	return request(serv.sysrest + '/api/advertisingSpace/queryAdversting', {
		method: 'get',
		data: data
	})
}

// 广告位
export function homePageBanner(data) {
	return request(serv.sysrest + '/api/advertisingSpace/homePageQuery', {
		method: 'get',
		data: data
	})
}

// 开屏须知
export function homeNotice(data) {
	return request(serv.sysrest + '/api/advertisingSpace/query', {
		method: 'get',
		data: data
	})
}
// 品牌优选的分类及商品
export function getAllHotBrandList(data) {
	return request(serv.sysrest + '/api/hotBrand/getAllHotBrandList',{
		method: 'get',
		data: data
	})
}

// 在线客服地址
export function onlineService(data) {
	return request(serv.sysrest + '/api/onlineCustomer/onlineRedirect', {
		method: 'post',
		data: data
	})
}